import time

# 方法1
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.remote.switch_to import SwitchTo

# dropdown菜单
from selenium.webdriver.support.ui import Select

wd = webdriver.Chrome(service=Service(".\chromedriver_win136.exe"))

wd.get("http://127.0.0.1:5000/elements/")

time.sleep(3)
# dropdown = wd.find_element(By.ID, "dropdown")
# dropdown.click()

dropdown = Select(wd.find_element(By.ID, "dropdown"))
time.sleep(5)
dropdown.select_by_visible_text("Boston Celtics")
time.sleep(5)
# 0-based index
dropdown.select_by_index(2)
time.sleep(5)


dropdown.select_by_value("warriors")
time.sleep(5)
